package com.ruoyi.project.system.hotword.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.hotword.mapper.HotWordMapper;
import com.ruoyi.project.system.hotword.domain.HotWord;
import com.ruoyi.project.system.hotword.service.IHotWordService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 热词Service业务层处理
 * 
 * @author LCL
 * @date 2020-06-19
 */
@Service
public class HotWordServiceImpl implements IHotWordService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private HotWordMapper hotWordMapper;

    /**
     * 查询热词
     * 
     * @param id 热词ID
     * @return 热词
     */
    @Override
    public HotWord selectHotWordById(String id)
    {
        return hotWordMapper.selectHotWordById(id);
    }

    /**
     * 查询热词列表
     * 
     * @param hotWord 热词
     * @return 热词
     */
    @Override
    public List<HotWord> selectHotWordList(HotWord hotWord)
    {
        return hotWordMapper.selectHotWordList(hotWord);
    }

    /**
     * 新增热词
     * 
     * @param hotWord 热词
     * @return 结果
     */
    @Override
    public int insertHotWord(HotWord hotWord)
    {
        hotWord.setId(this.idGererateFactory.nextStringId());
        return hotWordMapper.insertHotWord(hotWord);
    }

    /**
     * 修改热词
     * 
     * @param hotWord 热词
     * @return 结果
     */
    @Override
    public int updateHotWord(HotWord hotWord)
    {
        return hotWordMapper.updateHotWord(hotWord);
    }

    /**
     * 删除热词对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHotWordByIds(String ids)
    {
        return hotWordMapper.deleteHotWordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除热词信息
     * 
     * @param id 热词ID
     * @return 结果
     */
    @Override
    public int deleteHotWordById(String id)
    {
        return hotWordMapper.deleteHotWordById(id);
    }

    @Override
    public List<HotWord> findAll(String uid) {
        return this.hotWordMapper.findAll(uid);
    }

    @Override
    public void deleteByUid(String uid) {
        this.hotWordMapper.deleteByUid(uid);
    }

    @Override
    public HotWord findByName(String name, String uid) {
        return this.hotWordMapper.findByName(name,uid);
    }
}
